#pragma  once

#include "Common.h"
#include "ByteBuffer.h"
enum OrganType
{
	eInvalid = 0,
	eMasterControl,
	eConnAdapter,
	eShifter,
	eVisualizer,
	eAuditory,
	OrganTypeCount
};



class Connector;
class Assembler;
class DataPacket;
class Organ
{
private:
	Assembler* m_pAssm;
	Organ(){};
protected:
	OrganType  m_organType;
	bool		m_bInited;
public:
	Organ(Assembler* pAssm,OrganType  organType);
	virtual ~Organ();

	
	
//	virtual ErrorCode ConnectTo(Connector* pOutput);
//	virtual ErrorCode ConnectedBy(Connector* pInput);

	virtual ErrorCode Init();

	
	virtual ErrorCode PushData(char* pData, uint32 nLen) = 0;
	virtual ErrorCode OnReceive(const char* pData,uint32 nLen){ return eOK; }
	virtual	ErrorCode OnReceive(DataPacket& pack){ return eOK; }

	virtual void OnReady(uint32 ready);
	virtual ErrorCode Update(uint32 dtTime) = 0;

	inline OrganType GetType(){ return m_organType;}
	inline Assembler* GetAssembler() { return m_pAssm; }
	bool IsReady(){ return m_bInited; }
};